#!/bin/bash
#
# Pi-Star Hourly Cleanup Script
#

# Shrink NginX error log to stop it getting out of hand
echo "$(tail -500 /var/log/nginx/error.log)" > /var/log/nginx/error.log

# Clean up systemd logs
journalctl --rotate
journalctl --vacuum-time=24h
journalctl --vacuum-size=5M

# Mount the disk RO
/bin/sync
/bin/sync
/bin/sync
mount -o remount,ro /
mount -o remount,ro /boot
